package com.sishu.njrtsdms.validate;

import com.sishu.njrtsdms.annotation.ValidYear;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

import java.time.Year;

public class YearValidator
        implements ConstraintValidator<ValidYear, Year> {

    @Override
    public boolean isValid(Year value, ConstraintValidatorContext context) {
        if (value == null) {
            return false;
        }
        return value.getValue() > 2020;
    }
}
